package com.ruoyi.web.controller.comlbs;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.service.IProvincesService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 省、市、区
 *
 * @author wp
 * @email 163@qq.com
 * @date 2023-02-01 14:15:27
 */

@RestController
@RequestMapping("/comlbs/provinces")
public class ProvincesController extends BaseController {
    @Autowired
    private IProvincesService provincesService;

    @PostMapping("/getProvinceByDepth")
    @ApiOperation("按行政划分（省，市，区）查询行政区划")
    public AjaxResult getProvinceByDepth(@RequestParam Integer depth) {
        return success(provincesService.getByDepth(depth));
    }

    @ApiOperation("按上级区划查询行政区划")
    @PostMapping("/getProvinceByParent")
    public AjaxResult getProvinceByParent(@RequestParam Integer parentId) {
        return success(provincesService.getByParentId(parentId));
    }

}
